package com.smallkingson.ylib.core.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2016/12/16.
 */

public class TwoKeyCache <K, P, V>{

    public HashMap<K,Map<P,V>> cache=new HashMap<>();

    public V get(K k,P p) {
        Map<P, V> pvMap = cache.get(k);
        if (pvMap==null) {
            return null;
        }
        V v = pvMap.get(p);
        return v;
    }
    public void put(K k, P p, V v) {
        Map<P, V> pvMap = cache.get(k);
        if (pvMap==null) {
            pvMap = new HashMap<>();
            cache.put(k, pvMap);
        }
        pvMap.put(p, v);
    }
}
